package com.wjj.sixinone.controller.admin;


import com.wjj.sixinone.common.enums.ApiTypeConst;
import com.wjj.sixinone.common.pojo.vo.PatientForm;
import com.wjj.sixinone.common.pojo.vo.PatientVO;
import com.wjj.sixinone.common.util.Result;
import com.wjj.sixinone.service.PatientService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小王不秃头
 * @since 2024-07-22
 */
@RestController
@RequestMapping(ApiTypeConst.API_ADMIN+"/patient")
public class PatientController {
    @Autowired
    private PatientService patientService;
    @PostMapping("/addPatient")
    public Result addPatient(@RequestBody PatientForm patientForm){
        return patientService.addPatient(patientForm);
    };
//    public Result deletePatientById(Map<String,Integer> map)
    @GetMapping("/selectPatientByLimit")
    public Result selectPatientByLimit(PatientVO patientVO){
       return patientService.selectPatientByLimit(patientVO);
    }
    @PostMapping("/updateById")
    public Result updatePatientById(@RequestBody PatientForm patientForm){
        return patientService.updatePatientById(patientForm);
    };
    @GetMapping("/uploadExcel")
    public void uploadExcel(HttpServletResponse httpServletResponse){
        patientService.uploadExcel(httpServletResponse);
    }

    @PostMapping("/deleteById")
    public Result deleteById(@RequestBody Map<String,Integer> map){
        return patientService.deleteById(map);
    }

}

